package com.fr.base.core.antlr;

import com.fr.base.core.antlr.collections.impl.BitSet;

public class ANTLRTokdefParser extends LLkParser
  implements ANTLRTokdefParserTokenTypes
{
  private Tool antlrTool;
  public static final String[] _tokenNames = { "<0>", "EOF", "<2>", "NULL_TREE_LOOKAHEAD", "ID", "STRING", "ASSIGN", "LPAREN", "RPAREN", "INT", "WS", "SL_COMMENT", "ML_COMMENT", "ESC", "DIGIT", "XDIGIT" };
  public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
  public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());

  public void setTool(Tool paramTool)
  {
    if (this.antlrTool == null)
      this.antlrTool = paramTool;
    else
      throw new IllegalStateException("antlr.Tool already registered");
  }

  protected Tool getTool()
  {
    return this.antlrTool;
  }

  public void reportError(String paramString)
  {
    if (getTool() != null)
      getTool().error(paramString, getFilename(), -1, -1);
    else
      super.reportError(paramString);
  }

  public void reportError(RecognitionException paramRecognitionException)
  {
    if (getTool() != null)
      getTool().error(paramRecognitionException.getErrorMessage(), paramRecognitionException.getFilename(), paramRecognitionException.getLine(), paramRecognitionException.getColumn());
    else
      super.reportError(paramRecognitionException);
  }

  public void reportWarning(String paramString)
  {
    if (getTool() != null)
      getTool().warning(paramString, getFilename(), -1, -1);
    else
      super.reportWarning(paramString);
  }

  protected ANTLRTokdefParser(TokenBuffer paramTokenBuffer, int paramInt)
  {
    super(paramTokenBuffer, paramInt);
    this.tokenNames = _tokenNames;
  }

  public ANTLRTokdefParser(TokenBuffer paramTokenBuffer)
  {
    this(paramTokenBuffer, 3);
  }

  protected ANTLRTokdefParser(TokenStream paramTokenStream, int paramInt)
  {
    super(paramTokenStream, paramInt);
    this.tokenNames = _tokenNames;
  }

  public ANTLRTokdefParser(TokenStream paramTokenStream)
  {
    this(paramTokenStream, 3);
  }

  public ANTLRTokdefParser(ParserSharedInputState paramParserSharedInputState)
  {
    super(paramParserSharedInputState, 3);
    this.tokenNames = _tokenNames;
  }

  public final void file(ImportVocabTokenManager paramImportVocabTokenManager)
    throws RecognitionException, TokenStreamException
  {
    Token localToken = null;
    try
    {
      localToken = LT(1);
      match(4);
      while ((LA(1) == 4) || (LA(1) == 5))
        line(paramImportVocabTokenManager);
    }
    catch (RecognitionException localRecognitionException)
    {
      reportError(localRecognitionException);
      consume();
      consumeUntil(_tokenSet_0);
    }
  }

  public final void line(ImportVocabTokenManager paramImportVocabTokenManager)
    throws RecognitionException, TokenStreamException
  {
    Token localToken1 = null;
    Token localToken2 = null;
    Token localToken3 = null;
    Token localToken4 = null;
    Token localToken5 = null;
    Token localToken6 = null;
    Token localToken7 = null;
    Token localToken8 = null;
    Token localToken9 = null;
    try
    {
      Object localObject;
      if (LA(1) == 5)
      {
        localToken1 = LT(1);
        match(5);
        localToken9 = localToken1;
      }
      else if ((LA(1) == 4) && (LA(2) == 6) && (LA(3) == 5))
      {
        localToken2 = LT(1);
        match(4);
        localToken8 = localToken2;
        match(6);
        localToken3 = LT(1);
        match(5);
        localToken9 = localToken3;
      }
      else if ((LA(1) == 4) && (LA(2) == 7))
      {
        localToken4 = LT(1);
        match(4);
        localToken8 = localToken4;
        match(7);
        localToken5 = LT(1);
        match(5);
        match(8);
      }
      else if ((LA(1) == 4) && (LA(2) == 6) && (LA(3) == 9))
      {
        localToken6 = LT(1);
        match(4);
        localToken8 = localToken6;
      }
      else
      {
        throw new NoViableAltException(LT(1), getFilename());
      }
      match(6);
      localToken7 = LT(1);
      match(9);
      Integer localInteger = Integer.valueOf(localToken7.getText());
      if (localToken9 != null)
      {
        paramImportVocabTokenManager.define(localToken9.getText(), localInteger.intValue());
        if (localToken8 != null)
        {
          localObject = (StringLiteralSymbol)paramImportVocabTokenManager.getTokenSymbol(localToken9.getText());
          ((StringLiteralSymbol)localObject).setLabel(localToken8.getText());
          paramImportVocabTokenManager.mapToTokenSymbol(localToken8.getText(), (TokenSymbol)localObject);
        }
      }
      else if (localToken8 != null)
      {
        paramImportVocabTokenManager.define(localToken8.getText(), localInteger.intValue());
        if (localToken5 != null)
        {
          localObject = paramImportVocabTokenManager.getTokenSymbol(localToken8.getText());
          ((TokenSymbol)localObject).setParaphrase(localToken5.getText());
        }
      }
    }
    catch (RecognitionException localRecognitionException)
    {
      reportError(localRecognitionException);
      consume();
      consumeUntil(_tokenSet_1);
    }
  }

  private static final long[] mk_tokenSet_0()
  {
    long[] arrayOfLong = { 2L, 0L };
    return arrayOfLong;
  }

  private static final long[] mk_tokenSet_1()
  {
    long[] arrayOfLong = { 50L, 0L };
    return arrayOfLong;
  }
}